package com.sx.service.system;

import com.sx.basic.ResponseEntity;
import com.sx.basic.pageable.Condition;
import com.sx.entity.system.MenuEntity;
import com.sx.basic.IBasicService;
import org.apache.commons.lang3.StringUtils;

import java.util.List;

/**
 * @author AdinZ
 * @date 2020/11/7 18:27
 */
public interface IMenuService extends IBasicService<MenuEntity,Long> {
    default ResponseEntity<List<MenuEntity>> getList(String action){
        List<MenuEntity> list=findList(new Condition().eq("hide",true));
        if(StringUtils.isEmpty(action))
            return new ResponseEntity<>().toSuccess(list);
        return new ResponseEntity<>().toSuccess( MenuEntity.toChild(list,0));
    }

    List<MenuEntity> findMenu(MenuEntity.Action action);

}
